package com.qf.service.impl;

import com.qf.mapper.DeptMapper;
import com.qf.pojo.Dept;
import com.qf.service.DeptService;
import org.springframework.stereotype.Service;

import javax.annotation.Resource;
import java.util.List;

@Service
public class DeptServiceImpl implements DeptService {
    @Resource
    private DeptMapper deptMapper;

    @Override
    public List<Dept> findAll () {
        return deptMapper.findAll ();
    }

    @Override
    public int update (Dept dept) {

        try {
            int update = deptMapper.update (dept);
            return update;
        } catch (Exception e) {
          e.printStackTrace ();
        }
        return 0;
    }

    @Override
    public Dept add (Dept dept) {
        deptMapper.add(dept);
        return dept;
    }

    @Override
    public int delete (int id) {
        return deptMapper.delete(id);
    }
}
